/**
 * Created by wangxingsheng on 2020/7/9.
 */
public class AngleTest {
    public static void main(String[] args) {
        double degrees = 135.0;
        double radians = Math.toRadians(degrees);

        System.out.format("pi 的值为 %.4f%n", Math.PI);
        System.out.format("%.1f 度的正弦值是 %.4f%n", Math.toDegrees(Math.asin(Math.sin(radians))), Math.sin(radians));
        System.out.format("%.1f 度的正余弦值是 %.4f%n", Math.toDegrees(Math.acos(Math.cos(radians))), Math.cos(radians));
        System.out.format("%.1f 度的正切值是 %.4f%n", Math.toDegrees(Math.atan(Math.tan(radians))), Math.tan(radians));
        System.out.println(Math.pow(Math.sin(radians), 2) + Math.pow(Math.cos(radians), 2));

        double angle = 0;
        while (angle < 360) {
            System.out.format("angle:%.0f , y=(%.0f)%n", angle, Math.tan(Math.toRadians(angle)));
            angle += 45;
        }

        System.out.format("(-1,%.0f)\t(0,%.0f)\t(1,%.0f)"
                        + "%n%n%n" +
                        "(-1,%.0f)\t(0,0)\t(1,%.0f)"
                        + "%n%n%n" +
                        "(-1,%.0f)\t(0,%.0f)\t(1,%.0f)"
                , Math.tan(Math.toRadians(135)) * -1
                , Math.tan(Math.toRadians(90)) * 0 + 1
                , Math.tan(Math.toRadians(45))
                , Math.tan(Math.toRadians(180)) * -1
                , Math.tan(Math.toRadians(0))
                , Math.tan(Math.toRadians(225)) * -1
                , Math.tan(Math.toRadians(270)) * 0 - 1
                , Math.tan(Math.toRadians(315)));
    }
}
